package common.system.service;

import java.util.List;

import common.system.bean.Area;
import common.system.dao.AreaDao;

public class AreaServiceImpl implements AreaService{
	private AreaDao areaDao;
	@Override
	public Area getAreaByID(int id) {
		return this.getAreaDao().get(id);
	}

	@Override
	public List<Area> getAreaByCityId(int cityId) {
		return this.areaDao.getAreaByCityId(cityId);
	}
	@Override
	public boolean addArea(Area area) {
		int id = this.areaDao.save(area);
		if(id>0){
			return true;
		}else{
			return false;
		}
	}

	@Override
	public boolean updateArea(Area area) {
		try {
			this.areaDao.saveOrUpdate(area);
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}
	//getter and setter方法=========================

	public AreaDao getAreaDao() {
		return areaDao;
	}

	public void setAreaDao(AreaDao areaDao) {
		this.areaDao = areaDao;
	}

	
	
}
